﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;

namespace LuanVanProject
{
    /// <summary>
    /// Interaction logic for NotificationControl.xaml
    /// </summary>
    public partial class NotificationControl : UserControl
    {
        public bool OK;
        public NotificationControl()
        {
            InitializeComponent();
        }
        public void SetMessage(string s,bool isOK)
        {
            textLabel.Text = s;
            DoubleAnimation da = new DoubleAnimation();
            da.From = 0;
            da.To = 1;
            da.Duration = new Duration(TimeSpan.FromSeconds(2));
            DoubleAnimation da1 = new DoubleAnimation();
            da1.From = 1;
            da1.To = 0;
            da.Duration = new Duration(TimeSpan.FromSeconds(2));
            if (isOK == true)
            {
                OkIcon.Visibility = Visibility.Visible;
                NoIcon.Visibility = Visibility.Collapsed;
                textLabel.Foreground = Brushes.Green;
                OkIcon.BeginAnimation(OpacityProperty, da);
                textLabel.BeginAnimation(OpacityProperty, da);
                OkIcon.BeginAnimation(OpacityProperty, da1);
                textLabel.BeginAnimation(OpacityProperty, da1);
            }
            else
            {
                OkIcon.Visibility = Visibility.Collapsed;
                NoIcon.Visibility = Visibility.Visible;
                textLabel.Foreground = Brushes.Red;
                NoIcon.BeginAnimation(OpacityProperty, da);
                textLabel.BeginAnimation(OpacityProperty, da);
                NoIcon.BeginAnimation(OpacityProperty, da1);
                textLabel.BeginAnimation(OpacityProperty, da1);
            }
           
            
           
        }
    }
}
